{{indexmenu_n>2}}

====== Layers ======

  * Layers are one or more routes, tracks or waypoints that have been saved together into a single gpx file.
  * A layer is persistent and protected from changes.
  * A waypoint in a gpx file for example, can be imported either as a "waypoint" or as a layer. The difference is that when imported as a layer it cannot be changed or deleted.
  * Layers may be imported [[:opencpn:opencpn_user_manual:toolbar_buttons:route_mark_manager:layers#the_route_managers_layer_tab|"temporarily"]] or [[:opencpn:opencpn_user_manual:toolbar_buttons:route_mark_manager:layers#layer_directory_for_automatic_loading_of_permanent_layers|"permanently"]].

{{:opencpn:manual:layers-show2.png?nolink&}}

The Route Managers Layer Tab

{{:opencpn:manual:layer22.png?nolink&600x455}}

  * Layers are useful for many things. It can for example be used to update charts with new navigation marks and dangers as per Notices to Mariners, and to add Radio Call-In Points or to build a database of lights and locations, that will be visible on chart regardless of current scale. \\ The picture above displays a very good celestial fix, plotted with a gpx script saved as a layer. \\ It's also possible to share (other) POI's (Point Of Interest) by use of a layer. These could for example be mooring spots, places to bunker water or fuel etc.
  * More advanced uses could, for example, be an interactive cruising guide using the possibility to embed links in waypoint descriptions.


==== When is a feature a part of a Layer? ====

  * Layers are immutable, permanent, nothing can be changed. This could make them confusing, unless you are aware of the fact that they are layers!
  * To see if a waypoint, route or track, is a part of a layer, right-click the object. If it is part of a layer, the context sensitive menu will say so. Alternatively, open properties and check the top of the dialog. If part of a layer, the layer's name is printed. As always, double clicking on an object directly brings up the properties dialog,

{{:opencpn:manual:layer-track2.png?nolink&}}

{{:opencpn:manual:layer-prop.png?nolink&400x121}}

{{:opencpn:manual:layer-prop1.png?nolink&400x65}}

  * A route belonging to a layer is also identified as such, by just hovering with the cursor above the route.

{{:opencpn:manual:layer_route1.png?nolink&200x80}}

  * A Route belonging to a layer also has the option "Activate". It can thus be used, but still, no changes can be made. A much more flexible option, would be to import the route layer file as a normal gpx file.

==== Layer Directory for Automatic Loading of Permanent Layers ====

  * Layers can be created in OpenCPN and saved as a gpx file, or be created offline manually or by scripts, for example.
  * Layers that are saved in a directory called “layers” (created by the user) in the same location as your config “opencpn.ini ” file are automatically loaded on start of OpenCPN. These layers are known as “Permanent Layers”.
  * The layers that are saved to this directory will be listed in the Route Managers Layers Tab on start up. The first time they will all be visible. Adjust visibility by clicking on the "eye" in the first column. This setting will be remembered. Have a look at the first picture on this page!
  * The easiest way to find this directory is to go to the {{:opencpn:manual:help.png?nolink&28x31}}- button in the ToolBar and look all the way down in the first tab (About).
     * In Windows create the directory:// C:\ProgramData\opencpn\**layers**//  
     * In Linux create the directory:**// /home/$USER/.opencpn/layers//**
  * On Mac OS X, the location is "/Users/"username"/Library/Preferences/Layers". Note that "Library" is a hidden directory in "Lion". For Mac OS there are two "Library" directories, do not use the one for the system.
  * Any subdirectories in the layers directory are also loaded.
  * Layers worth keeping could be kept in the mentioned "layers" directory and visibility during a session can be handled through "Hide from Chart" or "Show on Chart" buttons. New layers, gpx files, can easily be added in a subdirectory of it's own.
  * A few restrictions apply to layer marks. A layer mark cannot be used to set anchor watch on. If right-click-selecting co-located objects, priority is given to non-layer objects.


==== The Route Managers Layer Tab. ====

  * **Temporary layer**: Any gpx file can be imported as a layer. This can be used for developing layers, or for import from a user defined directory with predefined layers, as necessary. Layers imported this way will be saved when closing down the computer, they are persistent. More permanent layers should be kept in the "layers" directory, as described above.
  * **Delete: **Unloads the layer, but doesn't of course touch the originally imported gpx file. A progress bar will appear when deleting large layers. It is not possible to stop the deletion, once started. For size restrictions, see below.
  * **Hide from Chart**  or **Show on Chart**  Controls if the marked layer is visible. The same thing can be achieved by clicking the "eye" to the left of the layers name. A red X across the eye marks a hidden layer. See picture above. These settings are persistent, they will be remembered after a restart.
  * **Hide WPT Names**  Shows a visible layer without waypoint names. This helps to un-clutter layers, when zoomed out.
  * **List contents **or **Delist Contents **Listing is this context means showing the individual points in the layer as waypoints in the "Waypoints Tab"
  * **Import GPX..**  and **Export All..****Warning**  these buttons has nothing to do with Layers. They work as if you are in an other tab. For import use "Import New Layers". For export, create layers as described above.
  * **Export All Visible**.. exports all visible layers, routes and waypoints to a gpx file. Use this button to create new layers, for example. Just save the gpxfile in the right place, described above. Note that "visible" in this context is the opposite to a layer, route or waypoint being "hidden". This means that objects not visible on the screen, may be included.
  * A progress bar will appear when exporting large layers. It is not possible to stop the deletion, once started. For size restrictions, see below.
  * If a layer includes extended marks, linked to pictures, for example, the pictures will not be exported, only the links to the pictures. To "export" the whole layer to another computer, copy all the pictures separately. Adjust all the links in the gpx file, to the new computer, by doing a "search and replace" in a text editor on the new computer.

==== Size Limits for the Layer feature. ====

  * There is no phisical limit in the number of items in a layer, but depending on the hardware and available memory, displaying (large) layers (10.000+ items) can slow down OpenCPN significantly.
  * Also Exporting and deleting layers, with many items in it, bogs down the program.
  * When using layers with many items, it is advisable to disable (large) layers zooming out or panning. When "in the right area" and at the desired "zoom" enable the desired layers again. \\ This way OpenCPN only has to handle the visible items in that particular area instead of ALL the items while zooming/panning and this will speed up the zooming and panning process significantly. \\ There is no point in keeping all the items visible when zoomed out anyway as all you will see is a lot of black "smear".
  * Deactivating OpenGL may improve the performance somewhat.


==== More on creating layers and saving data. ====

  * [[:opencpn:opencpn_user_manual:toolbar_buttons:route_mark_manager#export_import_gpx_files|Export and Import of GPX files]]
  * Have a look at// [[:opencpn:opencpn_user_manual:advanced_features:navigation_data_backup|]] //
  * [[:opencpn:opencpn_user_manual:toolbar_buttons:route_mark_manager:layers:creating_layers|Creating your own layers]]


==== Where to find ready made Layers? ====

  * A few samples are available in [[:opencpn:opencpn_user_manual:advanced_features:layers_library|]] on the OpenCPN.org.


==== User Guide for Layers ====

[[https://svmatilda.blogspot.com/2018/07/setting-up-waypoint-tracks-route-layers.html| SV Matilda - Setting up Waypoint Tracks & Route Layers]]

[[http://svmatilda.blogspot.com/2019/01/setting-up-layers-folder-in-openplotter.html|SV Matilda - Setting up layers folder in OpenPlotter]] 
